<template>
    <div class="community-item">
        <div class="list-main">
            <waterfall class="water-fall" :col='5' :width="216" :gutterWidth="11" :data="articleList">
                <!--            <vueWaterfallEasy :imgsArr="articleList" :imgWidth="216" :maxCols="5">-->
                <div v-for="(item ,index) in articleList" class="slot water-fall-slot" @click="handleClick"
                     v-if="item.articleCover">
                    <div class="slot-img">
                        <div class="shadow" v-if="item.articleType === 4"></div>
                        <img :lazy-src="item.articleCover" alt="">
                    </div>
                    <div class="time" v-if="item.articleType === 4">
                        <img src="@assets/player.png" height="28" width="28"/>
                        <div class="time-text">{{item.time}}</div>
                    </div>
                    <div class="text">
                        <div class="text-desc">{{item.articleName || item.articleContent}}</div>
                        <div class="text-name">
                            
                            <div class="user-left">
                                <img class="user-logo" v-if="item.userImgUrl" :src="item.userImgUrl" alt="">
                                <img class="user-logo" v-else src="@assets/touxiang.png" alt="">
                                <div class="user-name">{{item.nickName}}</div>
                            </div>
                            <div class="user-right">
                                <img src="@assets/grayLike.png" alt="" class="like-pic">
                                <div class="like-num">{{item.likeCount}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--            </vueWaterfallEasy>-->
            </waterfall>
        </div>
        <div class="more" @click="handleClick" v-if="articleList.length">
            查看全部
        </div>
    </div>
</template>

<script>
    import vueWaterfallEasy from 'vue-waterfall-easy'
    
    export default {
        name: "CommunityItem",
        props: {
            classifieId: {
                type: String,
                default: ''
            },
            articleList: Array,
        },
        components: {
            vueWaterfallEasy
        },
        
        data() {
            return {
                line: 'v',
            }
        },
        methods: {
            handleClick() {
                this.$parent.toggleDownload()
            }
        }
    }
</script>

<style lang="less">
    .list-main {
        width: 1130px;
        margin: 0 auto;
        padding-top: 20px;
        min-height: 900px;
        
        .water-fall {
            .slot {
                position: relative;
                width: 216px;
                margin-bottom: 10px;
                background: rgba(255, 255, 255, 1);
                box-shadow: 0px 2px 10px 0px rgba(112, 83, 6, 0.08);
                -webkit-border-radius: 8px;
                -moz-border-radius: 8px;
                border-radius: 8px;
                overflow: hidden;
                cursor: pointer;
                
                .slot-img {
                    position: relative;
                    width: 216px;
                    max-height: 384px;
                    min-height: 162px;
                    overflow: hidden;
                    
                    .shadow {
                        position: absolute;
                        width: 100%;
                        height: 100%;
                        background-color: rgba(0, 0, 0, .4);
                        z-index: 1;
                    }
                    
                    img {
                        width: 100%;
                        height: 100%;
                        min-height: 162px;
                        max-height: 384px;
                    }
                }
                
                .time {
                    .flexed();
                    position: absolute;
                    right: 17px;
                    bottom: 105px;
                    width: 65px;
                    height: 24px;
                    background: rgba(255, 255, 255, .8);
                    border-radius: 12px;
                    z-index: 99;
                    
                    img {
                        width: 14px;
                        height: 14px;
                        margin-right: 4px;
                    }
                    
                    .time-text {
                        height: 24px;
                        font-size: 14px;
                        font-weight: bold;
                        line-height: 24px;
                        color: rgba(0, 0, 0, 1);
                    }
                }
                
                .text {
                    width: 216px;
                    /*height: 92px;*/
                    padding: 12px 16px;
                    box-sizing: border-box;
                    
                    .text-desc {
                        word-wrap: break-word;
                        margin-bottom: 12px;
                        .textEllipsis(2);
                        width: 184px;
                        height: 40px;
                        font-size: 14px;
                        font-weight: 500;
                        color: rgba(0, 0, 0, 1);
                        line-height: 20px;
                    }
                    
                    .text-name {
                        .flexed(space-between);
                        
                        .user-left {
                            .flexed(flex-start);
                            
                            .user-logo {
                                width: 20px;
                                height: 20px;
                                margin-right: 4px;
                                border-radius: 50%;
                            }
                            
                            .user-name {
                                width: 84px;
                                .textEllipsis(1);
                                overflow: hidden;
                            }
                        }
                        
                        
                        .user-right {
                            .flexed(flex-end);
                            
                            .like-pic {
                                width: 14px;
                                height: 14px;
                                margin-right: 4px;
                            }
                            
                            .like-num {
                                text-align: right;
                                font-size: 14px;
                                color: rgba(0, 0, 0, 1);
                                opacity: .5;
                            }
                        }
                        
                    }
                }
            }
            
        }
        
        
    }
    
    .more {
        width: 124px;
        margin: 0 auto;
        margin-bottom: 20px;
        font-size: 22px;
        font-weight: bold;
        color: rgba(0, 0, 0, 1);
        line-height: 37px;
        -webkit-background-clip: text;
        text-align: center;
        cursor: pointer;
    }
</style>
